package cn.qh.seasonal.biz.Impl;

import cn.qh.seasonal.biz.UserBiz;
import cn.qh.seasonal.entity.User;
import cn.qh.seasonal.exception.NotFoundException;
import cn.qh.seasonal.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description: TODO
 * @author: MengJiaLin
 * @date: 2021年11月11日 12:24
 */
@Service
public class UserBizImpl implements UserBiz {
    @Resource
    private UserService userservice;


    @Override
    public User login(String userName, String userPassWord) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("userName", userName);
        queryWrapper.eq("userPassWord", userPassWord);
        User one = userservice.getOne(queryWrapper);
        if (one == null) {
            throw new NotFoundException(1003);
        }


        return one;
    }


}













